{itemplate 'public/header'}
<style>
	.store.shopcategory header.header1{background: none;}
	.store.shopcategory header .title{display: none;}
	.store.shopcategory header{z-index: 10000;}
	.store.shopcategory .searchbar{background: none; width: 80%; padding-left: 1.5rem;}
	.store.shopcategory .searchbar .search-input .icon-search{font-size: 0.8rem; padding: 0; margin-top: 0.1rem;}
	.store.shopcategory .searchbar .search-input #search{border-radius: 0.8rem;}
	.store.shopcategory .content{top: 0; z-index: 9999;}
	.store.shopcategory .store-container{padding: 2.2rem 0 0.2rem 0.5rem; color: #fff; position: relative; font-size: 0.55rem;}
	.store.shopcategory .store-container .store-container-inner{position: absolute; width: 100%; height: 100%; top: 0; left: 0; z-index: 0; background-image: url(../addons/we7_wmall/template/mobile/wmall/default/static/img/store-bg.jpeg); background-repeat: no-repeat; background-size: cover;}
	.store.shopcategory .store-container .no-gutter{margin-bottom: 0.2rem;}
	.store.shopcategory .store-container .no-gutter>div{height: 3rem; position: relative; z-index: 9;}
	.store.shopcategory .store-container .col-65{width: 65%;}
	.store.shopcategory .store-container img{width: 3rem; height: 3rem; border-radius: 0.2rem;}
	.store.shopcategory .store-container .store-title{font-size: 0.7rem; line-height: 1.2rem; font-weight: bold; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
	.store.shopcategory .store-container .store-delivery{margin-bottom: 0.1rem;}
	.store.shopcategory .store-container .store-delivery span{font-size: .5rem; background: #ff2d4b; border-radius: 7px 0 7px 0; color: #fff; padding: 0.1rem .3rem 0; margin-right: 0.3rem;}
	.store.shopcategory .store-container .notice{overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
	.store.shopcategory .store-container #btn-favorite{display: block; height: 3rem; color: #fff; text-align: center; padding: 0.5rem 0;}
	.store.shopcategory .store-container #btn-favorite span{display: block; line-height: 2rem;}
	.store.shopcategory .store-container #btn-favorite .icon{font-size: 1rem;}
	.store.shopcategory .activity-container{height: 1rem; color: #fff; position: relative; z-index: 10000; overflow: hidden;}
	.store.shopcategory .activity-container ul li{line-height: 1rem; max-width: 80%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
	.store.shopcategory .activity-container .tags:before{padding-bottom: 0;}
	.store.shopcategory .activity-container .activity-num{position: absolute; right: 0.5rem; top: 0; line-height: 1rem;}
	.store.shopcategory .buttons-tab{position: relative; top: 0; z-index: 10200; width: 100%; max-width: 640px; margin: 0 auto;}
	.store.shopcategory .parent-category-wrapper{position: absolute; top: 0;}
	.store.shopcategory .parent-category-wrapper .parent-category{position: relative; width: 100%; max-width: 128px;}
	.store.shopcategory .category-container{position: relative; top: 0; width: 100%; min-height: 100%;}
</style>
<script type='text/javascript' src='{WE7_WMALL_URL}static/js/components/light7/iscroll-probe.js' charset='utf-8'></script>
<div class="page store shopcategory" id="page-app-goods">
	<nav class="bar bar-tab no-gutter shop-cart-bar">
		<div class="" id="cartEmpty">
			<div class="left empty">
				<span class="cart">
					<span class="icon icon-cart"></span>
				</span>
				购物车是空的
			</div>
			<div class="right text-center bg-grey">{$store['send_price']}元起送</div>
		</div>
		<div class="hide" id="cartNotEmpty">
			<div class="left">
				<span class="cart">
					<span class="icon icon-cart"></span>
					<span class="badge bg-danger" id="cartNum">0</span>
				</span>
				共<span class="sum">￥<span id="totalPrice">0</span>元</span>
			</div>
			<div class="right text-center bg-grey" id="categoryCondition">还差￥0元起送</div>
			<div class="right text-center bg-grey">还差￥<span id="sendCondition">{$store['send_price']}</span>元起送</div>
			{if !$store['is_in_business_hours']}
				<div class="right text-center bg-grey hide" id="btnSubmit">休息中</div>
			{else}
				<div class="right text-center bg-danger hide" id="btnSubmit">选好了</div>
			{/if}
		</div>
	</nav>
	{if !empty($activity['items']['discount'])}
		<div class="store-discount-notice">
			<div class="inner">{$activity['items']['discount']['title']}</div>
		</div>
	{elseif !empty($activity['items']['grant'])}
		<div class="store-discount-notice">
			<div class="inner">{$activity['items']['grant']['title']}</div>
		</div>
	{/if}
	<header class="bar bar-nav common-bar-nav header1">
		<a class="pull-left back" href="javascript:;"><i class="icon icon-arrow-left"></i></a>
		<div class="searchbar pull-left hide">
			<div class="search-input">
				<label class="icon icon-search" for="search"></label>
				<input type="search" id='search' placeholder='搜索店内商品'/>
			</div>
		</div>
		<h1 class="title">{$store['title']}</h1>
		<a class="pull-right" href="javascript:;"><span class="icon icon-search"></span></a>
	</header>
	<div class="content lazyload-container">
		<div class="store-container">
			<div class="row no-gutter">
				<div class="col-20 open-popup" data-popup=".popup-privilege">
					<img src="{$store['logo']}" alt=""/>
				</div>
				<div class="col-65 open-popup" data-popup=".popup-privilege">
					<div class="store-title">{$store['title']}</div>
					<div class="store-delivery">
						{if $store['delivery_mode'] == 2}
							<span>{$_config_mall['delivery_title']}</span>
						{/if}
						{$store['delivery_time']}分钟送达
					</div>
					<div class="notice"><span class="icon icon-notification"></span> {$store['notice']}</div>
				</div>
				<div class="col-15">
					<a id="btn-favorite" data-id="{$store['id']}" data-uid="{$_W['member']['uid']}">
						<span class="border-1px-l"><i class="icon {if !empty($is_favorite)}icon-favorfill{else}icon-favor{/if}"></i></span>
					</a>
				</div>
			</div>
			{if $activity['num'] > 0}
				<div class="activity-container open-popup" data-popup=".popup-privilege">
					<div class="js-notice" data-speed="4">
						<ul>
							{loop $activity['items'] $item}
								<li>
									<div class="tags tags-{$item['type']}">{$item['title']}</div>
								</li>
							{/loop}
						</ul>
						<div class="activity-num">{$activity['num']}个活动 <i class="icon icon-arrow-right"></i></div>
					</div>
				</div>
			{/if}
			<div class="store-container-inner"></div>
		</div>
		<div class="buttons-tab">
			<a href="{php echo imurl('wmall/store/goods', array('sid' => $store['id']));}" class="button active">商品</a>
			<a href="{php echo imurl('wmall/store/comment', array('sid' => $store['id']));}" class="button">评价</a>
			<a href="{php echo imurl('wmall/store/index', array('sid' => $store['id']));}" class="button">车主</a>
			{if !empty($store['sns']['qq'])}
				<a href="http://wpa.qq.com/msgrd?v=3&uin={$store['sns']['qq']}&site=qq&menu=yes" class="button">客服</a>
			{/if}
		</div>
		<div class="category-container" id="category-container">
			<div class="parent-category-wrapper">
				<div class="parent-category">
					<div id="cateMenu">
						<ul class="category-list">
							{loop $categorys $category}
							{if !empty($cate_goods[$category['id']])}
							<li class="border-1px-b">
								<a href="javascript:;">
									{if $category['bargain_id'] > 0}
									<svg class="svg" aria-hidden="true">
										<use xlink:href="#svg-tag"></use>
									</svg>
									{/if}
									{$category['title']}
								</a>
							</li>
							{/if}
							{/loop}
						</ul>
					</div>
				</div>
			</div>
			<div class="children-category">
				{if !empty($tokens)}
					<div class="coupon-show-container">
						<div class="coupon-show">
							<div class="coupon-sum">
								<span>￥</span>{$token_price}
							</div>
							<div class="division">
								<img src="{WE7_WMALL_TPL_URL}static/img/division.png" alt="" />
							</div>
							<div class="coupon-info">
								<div class="coupon-title">车主代金券</div>
								{if $token_nums > 1}
								<div class="condition">内含{$token_nums}张券</div>
								{else}
								<div class="condition">满{$token['condition']}元可用</div>
								{/if}
							</div>
							<div class="get">
								<span class="btn-get" id="get-coupon">领券</span>
							</div>
						</div>
					</div>
				{/if}
				<form action="{php echo imurl('wmall/order/create/goods', array('sid' => $sid));}" method="post" id="goods-form">
					<input type="hidden" name="goods" value=""/>
					{loop $categorys $cate_row}
						{if !empty($cate_goods[$cate_row['id']])}
							<div class="children-category-wrapper">
								<div class="heading"><span>{$cate_row['title']}</span> {if $cate_row['min_fee'] > 0}<small>最低消费{$cate_row['min_fee']}元</small>{/if}</div>
								<ul class="list-block media-list">
								{loop $cate_goods[$cate_row['id']] $ds}
									<li id="goods-{$ds['id']}" {if $_GPC['goods_id'] == $ds['id']}class="active"{/if}>
										<a class="item-content goods-popup" data-id="{$ds['id']}" href="javascript:;">
											<div class="item-media">
												{if !empty($ds['label'])}
													<span class="sale-badge bg-danger">{$ds['label']}</span>
												{/if}
												<img src="{WE7_WMALL_TPL_URL}static/img/hm.gif" class="lazyload" data-original="{php echo tomedia($ds['thumb']);}" alt=""/>
											</div>
											<div class="item-inner">
												<div class="item-title-row">
													<div class="item-title">{$ds['title']}</div>
												</div>
												<div class="item-text">
													{if !empty($ds['content'])}
														<div class="goods-info">{$ds['content']}</div>
													{/if}
													<div class="sell-info">已售{$ds['sailed']}{$ds['unitname']}&nbsp;&nbsp; 好评{$ds['comment_good']}</div>
													<div class="price">
														<span class="fee">￥{$ds['discount_price']}</span>
														{if !empty($ds['bargain_id'])}
															<span class="original-fee">￥{$ds['price']}</span>
														{/if}
													</div>
													{if !empty($ds['discount'])}
														<span class="tag tag-danger">{if $ds['poi_user_type'] == 'new'}新用户专享{/if} {$ds['discount']}折 每单仅限{$ds['max_buy_limit']}份</span>
													{/if}
												</div>
											</div>
										</a>
										{if $store['is_in_business_hours']}
											{if !$ds['is_options']}
												{if !$ds['discount_available_total'] && !$ds['total']}
													<div class="goods-tips">已售完</div>
												{else}
													<div class="operate-num operate-goods">
														<span class="hide minus">
															<span class="icon icon-minus" data-goods-id="{$ds['id']}" data-option-id="0"></span>
															<span class="num">0</span>
														</span>
														<span class="icon icon-plus" data-goods-id="{$ds['id']}" data-option-id="0"></span>
													</div>
												{/if}
											{elseif $ds['is_options'] == 1}
												<div class="operate-goods">
													<span class="select-spec goods-option" data-id="{$ds['id']}">可选规格</span>
												</div>
											{/if}
										{else}
											<div class="goods-tips">店铺休息中</div>
										{/if}
									</li>
								{/loop}
								</ul>
							</div>
						{/if}
					{/loop}
				</form>
			</div>
		</div>
	</div>
</div>
{itemplate 'store/goodsCommon'}
<script>
	$(".content").on('scroll', function() {
		var scrollTop = $(".content").scrollTop();
		if(scrollTop > 0) {
			$('header').removeClass('header1');
			$('header .title').fadeIn();
		} else {
			$('header').addClass('header1');
			$('header .title').fadeOut();
		}
		var height = $('.store-container').height() + 2;
		if(scrollTop > height) {
			$(".parent-category").css({'position': 'fixed', 'top': '4.2rem', 'width': '20%'});
			$('.buttons-tab').css({'position': 'fixed', 'top': '2.2rem'});

		} else {
			$(".parent-category").css({'position': 'relative', 'top': '0', 'width': '100%'});
			$('.buttons-tab').css({'position': 'relative', 'top': '0'});
		}
	});

	$(document).on('focus', '#search', function() {
		$.popup('.popup-search');
	});

	if ($(".js-notice").length > 0) {
		$(".js-notice").each(function () {
			var _this = $(this);
			var speed = _this.data('speed') * 1000;
			setInterval(function () {
				var length = _this.find("li").length;
				if (length > 1) {
					_this.find("ul").animate({marginTop: "-1rem"}, 500, function () {
						$(this).css({marginTop: "0px"}).find("li:first").appendTo(this)
					})
				}
			}, speed)
		})
	}
</script>
{itemplate 'public/footer'}